package min.chapter.three;

import java.util.Locale;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MessageSourceAcquisition {

	public static void main(String[] args) {

		String[] configLocations = new String[] { "min/chapter/three/MessageSource.xml" };
		AbstractApplicationContext context = new ClassPathXmlApplicationContext(
				configLocations);
		context.registerShutdownHook();
		Locale locale = Locale.getDefault();
		String greeting = context.getMessage("greeting", new Object[0], locale);
		System.out.println("Default Locale Greeting: " + greeting);
		Locale englishLocale = Locale.ENGLISH;
		String englishGreeting = context.getMessage("greeting", new Object[0],
				englishLocale);
		System.out.println("English Locale Greeting: " + englishGreeting);
	}

}
